package binarysearch.test154;

/**
 * 寻找旋转排序数组中的最小值 II
 * @author code_yc
 * @version 1.0
 * @date 2020/7/13 8:55
 */
public class Solution1 {

    // 寻找重复的元素
    public int findMin(int[] nums) {
        return bs(nums, 0, nums.length - 1);
    }

    private int bs(int[] nums, int l, int r){
        if(l == r) return nums[l];
        int mid = (l + r) >> 1;
        int left = bs(nums, l, mid);
        int right = bs(nums, mid + 1, r);
        return Math.min(left, right);
    }
}
